package com.lagou.edu.context.fatory;



import com.lagou.edu.context.MetadataReader;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @Author zhaozuowen
 * @Description
 * @Date 2020-01-11 11:47
 **/

public class CachingMetadataReaderFactory implements MetadataReaderFactory {

    public Map<Class, MetadataReader> map=new ConcurrentHashMap<>();


    @Override
    public MetadataReader getMetadataReader(Class aclass) {
        MetadataReader metadataReader = map.get(aclass);
        if(metadataReader==null){
            metadataReader=new SimpleMetadataReader(aclass);
        }
        return metadataReader;
    }
}
